﻿<UserControl x:Class="Freshome.m.vws.Majoraws"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:v="clr-namespace:Freshome.m.vws"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <UserControl.Resources>
        <v:Bool2Visible x:Key="b2v" />
    </UserControl.Resources>
    <Grid x:Name="topanel">
        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition MinWidth="100"></ColumnDefinition>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
            <ColumnDefinition MinWidth="100"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <ScrollViewer>
            <StackPanel>
                <Expander x:Name="elt" Header="肉类（猪、牛、羊、鸡、鸭、鹅等）" IsExpanded="True">
                    <DataGrid x:Name="dgmeat" ItemsSource="{Binding Path=P_meat}" IsReadOnly="{Binding Readonly}">
                        <DataGrid.CommandBindings>
                            <CommandBinding Command="ApplicationCommands.Delete" CanExecute="Majoraw_CanExecute" Executed="Delete_Executed" />
                            <CommandBinding Command="ApplicationCommands.Find" CanExecute="Find_CanExecuted" Executed="Find_Executed" />
                        </DataGrid.CommandBindings>
                        <DataGrid.RowDetailsTemplate>
                            <DataTemplate>
                                <TextBlock><Hyperlink Command="ApplicationCommands.Find" CommandParameter="{Binding Path=Raw.Mid}">肉类搭配</Hyperlink></TextBlock>
                            </DataTemplate>
                        </DataGrid.RowDetailsTemplate>
                        <DataGrid.ContextMenu>
                            <ContextMenu Visibility="{Binding Path=Enabled, Converter={StaticResource b2v}}">
                                <MenuItem Header="肉类搭配" Command="ApplicationCommands.Find"></MenuItem>
                                <Separator />
                                <MenuItem Header="删除肉类" Command="ApplicationCommands.Delete"></MenuItem>
                            </ContextMenu>
                        </DataGrid.ContextMenu>
                        <DataGrid.Columns>
                            <DataGridTextColumn Binding="{Binding Path=Name}" Header="肉类名称" 
                                    MinWidth="100" MaxWidth="200" ToolTipService.ToolTip="2 - 10个字符"/>
                            <DataGridTextColumn Binding="{Binding Path=Notes}" Header="肉类说明" 
                                    MinWidth="200" MaxWidth="500" ToolTipService.ToolTip="0 - 50个字符"/>
                        </DataGrid.Columns>
                    </DataGrid>
                </Expander>
                <Expander x:Name="elm" Header="水产（鱼、鳖、虾、蟹等）" IsExpanded="False">
                    <DataGrid x:Name="dgwater" ItemsSource="{Binding Path=P_water}" IsReadOnly="{Binding Readonly}">
                        <DataGrid.CommandBindings>
                            <CommandBinding Command="ApplicationCommands.Delete" CanExecute="Majoraw_CanExecute" Executed="Delete_Executed" />
                            <CommandBinding Command="ApplicationCommands.Find" CanExecute="Find_CanExecuted" Executed="Find_Executed" />
                        </DataGrid.CommandBindings>
                        <DataGrid.RowDetailsTemplate>
                            <DataTemplate>
                                <TextBlock><Hyperlink Command="ApplicationCommands.Find" CommandParameter="{Binding Path=Raw.Mid}">水产搭配</Hyperlink></TextBlock>
                            </DataTemplate>
                        </DataGrid.RowDetailsTemplate>
                        <DataGrid.ContextMenu>
                            <ContextMenu Visibility="{Binding Path=Enabled, Converter={StaticResource b2v}}">
                                <MenuItem Header="水产搭配" Command="ApplicationCommands.Find"></MenuItem>
                                <Separator />
                                <MenuItem Header="删除水产" Command="ApplicationCommands.Delete"></MenuItem>
                            </ContextMenu>
                        </DataGrid.ContextMenu>
                        <DataGrid.Columns>
                            <DataGridTextColumn Binding="{Binding Path=Name}" Header="水产名称" 
                                    MinWidth="100" MaxWidth="200" ToolTipService.ToolTip="2 - 10个字符"/>
                            <DataGridTextColumn Binding="{Binding Path=Notes}" Header="水产说明" 
                                    MinWidth="200" MaxWidth="500" ToolTipService.ToolTip="0 - 50个字符"/>
                        </DataGrid.Columns>
                    </DataGrid>
                </Expander>
                <Expander Header="米面类（米、面、红豆等）" x:Name="elb" IsExpanded="False">
                    <DataGrid x:Name="dgrain" ItemsSource="{Binding Path=P_grain}" IsReadOnly="{Binding Readonly}">
                        <DataGrid.CommandBindings>
                            <CommandBinding Command="ApplicationCommands.Delete" CanExecute="Majoraw_CanExecute" Executed="Delete_Executed" />
                            <CommandBinding Command="ApplicationCommands.Find" CanExecute="Find_CanExecuted" Executed="Find_Executed" />
                        </DataGrid.CommandBindings>
                        <DataGrid.RowDetailsTemplate>
                            <DataTemplate>
                                <TextBlock><Hyperlink Command="ApplicationCommands.Find" CommandParameter="{Binding Path=Raw.Mid}">米面主料搭配</Hyperlink></TextBlock>
                            </DataTemplate>
                        </DataGrid.RowDetailsTemplate>
                        <DataGrid.ContextMenu>
                            <ContextMenu Visibility="{Binding Path=Enabled, Converter={StaticResource b2v}}">
                                <MenuItem Header="米面搭配" Command="ApplicationCommands.Find"></MenuItem>
                                <Separator />
                                <MenuItem Header="删除米面" Command="ApplicationCommands.Delete"></MenuItem>
                            </ContextMenu>
                        </DataGrid.ContextMenu>
                        <DataGrid.Columns>
                            <DataGridTextColumn Binding="{Binding Path=Name}" Header="米面名称" 
                                    MinWidth="100" MaxWidth="200" ToolTipService.ToolTip="2 - 10个字符"/>
                            <DataGridTextColumn Binding="{Binding Path=Notes}" Header="米面说明" 
                                    MinWidth="200" MaxWidth="500" ToolTipService.ToolTip="0 - 50个字符"/>
                        </DataGrid.Columns>
                    </DataGrid>
                </Expander>
                <Expander x:Name="ela" Header="豆制品（老豆腐、嫩豆腐、腐竹、粉丝等）" IsExpanded="False">
                    <DataGrid x:Name="dgbean" ItemsSource="{Binding Path=P_bean}" IsReadOnly="{Binding Readonly}">
                        <DataGrid.CommandBindings>
                            <CommandBinding Command="ApplicationCommands.Delete" CanExecute="Majoraw_CanExecute" Executed="Delete_Executed" />
                            <CommandBinding Command="ApplicationCommands.Find" CanExecute="Find_CanExecuted" Executed="Find_Executed" />
                        </DataGrid.CommandBindings>
                        <DataGrid.RowDetailsTemplate>
                            <DataTemplate>
                                <TextBlock><Hyperlink Command="ApplicationCommands.Find" CommandParameter="{Binding Path=Raw.Mid}">豆制品搭配</Hyperlink></TextBlock>
                            </DataTemplate>
                        </DataGrid.RowDetailsTemplate>
                        <DataGrid.ContextMenu>
                            <ContextMenu Visibility="{Binding Path=Enabled, Converter={StaticResource b2v}}">
                                <MenuItem Header="豆制品搭配" Command="ApplicationCommands.Find"></MenuItem>
                                <Separator />
                                <MenuItem Header="删除豆制品" Command="ApplicationCommands.Delete"></MenuItem>
                            </ContextMenu>
                        </DataGrid.ContextMenu>
                        <DataGrid.Columns>
                            <DataGridTextColumn Binding="{Binding Path=Name}" Header="豆制品名称" 
                                    MinWidth="100" MaxWidth="200" ToolTipService.ToolTip="2 - 10个字符"/>
                            <DataGridTextColumn Binding="{Binding Path=Notes}" Header="豆制品说明" 
                                    MinWidth="200" MaxWidth="500" ToolTipService.ToolTip="0 - 50个字符"/>
                        </DataGrid.Columns>
                    </DataGrid>
                </Expander>
                <Expander x:Name="elnut" Header="坚果类（花生、板栗、核桃、杏仁等）" IsExpanded="False">
                    <DataGrid x:Name="dgnut" ItemsSource="{Binding Path=P_nut}" IsReadOnly="{Binding Readonly}">
                        <DataGrid.CommandBindings>
                            <CommandBinding Command="ApplicationCommands.Delete" CanExecute="Majoraw_CanExecute" Executed="Delete_Executed" />
                            <CommandBinding Command="ApplicationCommands.Find" CanExecute="Find_CanExecuted" Executed="Find_Executed" />
                        </DataGrid.CommandBindings>
                        <DataGrid.RowDetailsTemplate>
                            <DataTemplate>
                                <TextBlock><Hyperlink Command="ApplicationCommands.Find" CommandParameter="{Binding Path=Raw.Mid}">坚果类搭配</Hyperlink></TextBlock>
                            </DataTemplate>
                        </DataGrid.RowDetailsTemplate>
                        <DataGrid.ContextMenu>
                            <ContextMenu Visibility="{Binding Path=Enabled, Converter={StaticResource b2v}}">
                                <MenuItem Header="坚果类搭配" Command="ApplicationCommands.Find"></MenuItem>
                                <Separator />
                                <MenuItem Header="删除坚果类" Command="ApplicationCommands.Delete"></MenuItem>
                            </ContextMenu>
                        </DataGrid.ContextMenu>
                        <DataGrid.Columns>
                            <DataGridTextColumn Binding="{Binding Path=Name}" Header="坚果名称" 
                                    MinWidth="100" MaxWidth="200" ToolTipService.ToolTip="2 - 10个字符"/>
                            <DataGridTextColumn Binding="{Binding Path=Notes}" Header="坚果说明" 
                                    MinWidth="200" MaxWidth="500" ToolTipService.ToolTip="0 - 50个字符"/>
                        </DataGrid.Columns>
                    </DataGrid>
                </Expander>
            </StackPanel>
        </ScrollViewer>
        <TextBlock Grid.Row="1" Grid.Column="0">食谱可按主料条目分类，佐料不能用于菜谱分类。</TextBlock>
        <GridSplitter Grid.Row="0" Grid.Column="1" Grid.RowSpan="2" Width="3" VerticalAlignment="Stretch" HorizontalAlignment="Center" ShowsPreview="True"></GridSplitter>
        <ScrollViewer Grid.Column="2">
            <StackPanel>
                <Expander x:Name="ert" Header="蔬菜（土豆、青椒、豆角、青菜等）" IsExpanded="True">
                    <DataGrid x:Name="dgreen" ItemsSource="{Binding Path=P_green}" IsReadOnly="{Binding Readonly}">
                        <DataGrid.CommandBindings>
                            <CommandBinding Command="ApplicationCommands.Delete" CanExecute="Majoraw_CanExecute" Executed="Delete_Executed" />
                            <CommandBinding Command="ApplicationCommands.Find" CanExecute="Find_CanExecuted" Executed="Find_Executed" />
                        </DataGrid.CommandBindings>
                        <DataGrid.RowDetailsTemplate>
                            <DataTemplate>
                                <TextBlock><Hyperlink Command="ApplicationCommands.Find" CommandParameter="{Binding Path=Raw.Mid}">蔬菜搭配</Hyperlink></TextBlock>
                            </DataTemplate>
                        </DataGrid.RowDetailsTemplate>
                        <DataGrid.ContextMenu>
                            <ContextMenu Visibility="{Binding Path=Enabled, Converter={StaticResource b2v}}">
                                <MenuItem Header="蔬菜搭配" Command="ApplicationCommands.Find"></MenuItem>
                                <Separator />
                                <MenuItem Header="删除蔬菜" Command="ApplicationCommands.Delete"></MenuItem>
                            </ContextMenu>
                        </DataGrid.ContextMenu>
                        <DataGrid.Columns>
                            <DataGridTextColumn Binding="{Binding Path=Name}" Header="蔬菜名称" 
                                    MinWidth="100" MaxWidth="200" ToolTipService.ToolTip="2 - 10个字符"/>
                            <DataGridTextColumn Binding="{Binding Path=Notes}" Header="蔬菜说明" 
                                    MinWidth="200" MaxWidth="500" ToolTipService.ToolTip="0 - 50个字符"/>
                        </DataGrid.Columns>
                    </DataGrid>
                </Expander>
                <Expander x:Name="erm" Header="禽蛋（鸡蛋、鸭蛋、鹌鹑蛋、鹅蛋等）" IsExpanded="False">
                    <DataGrid x:Name="dgegg" ItemsSource="{Binding Path=P_egg}" IsReadOnly="{Binding Readonly}">
                        <DataGrid.CommandBindings>
                            <CommandBinding Command="ApplicationCommands.Delete" CanExecute="Majoraw_CanExecute" Executed="Delete_Executed" />
                            <CommandBinding Command="ApplicationCommands.Find" CanExecute="Find_CanExecuted" Executed="Find_Executed" />
                        </DataGrid.CommandBindings>
                        <DataGrid.RowDetailsTemplate>
                            <DataTemplate>
                                <TextBlock><Hyperlink Command="ApplicationCommands.Find" CommandParameter="{Binding Path=Raw.Mid}">禽蛋搭配</Hyperlink></TextBlock>
                            </DataTemplate>
                        </DataGrid.RowDetailsTemplate>
                        <DataGrid.ContextMenu>
                            <ContextMenu Visibility="{Binding Path=Enabled, Converter={StaticResource b2v}}">
                                <MenuItem Header="禽蛋搭配" Command="ApplicationCommands.Find"></MenuItem>
                                <Separator />
                                <MenuItem Header="删除禽蛋" Command="ApplicationCommands.Delete"></MenuItem>
                            </ContextMenu>
                        </DataGrid.ContextMenu>
                        <DataGrid.Columns>
                            <DataGridTextColumn Binding="{Binding Path=Name}" Header="禽蛋名称" 
                                    MinWidth="100" MaxWidth="200" ToolTipService.ToolTip="2 - 10个字符"/>
                            <DataGridTextColumn Binding="{Binding Path=Notes}" Header="禽蛋说明" 
                                    MinWidth="200" MaxWidth="500" ToolTipService.ToolTip="0 - 50个字符"/>
                        </DataGrid.Columns>
                    </DataGrid>
                </Expander>
                <Expander x:Name="erb" Header="水果（香蕉、苹果、鸭梨、榴莲等）" IsExpanded="False">
                    <DataGrid x:Name="dgfruit" ItemsSource="{Binding Path=P_fruit}" IsReadOnly="{Binding Readonly}">
                        <DataGrid.CommandBindings>
                            <CommandBinding Command="ApplicationCommands.Delete" CanExecute="Majoraw_CanExecute" Executed="Delete_Executed" />
                            <CommandBinding Command="ApplicationCommands.Find" CanExecute="Find_CanExecuted" Executed="Find_Executed" />
                        </DataGrid.CommandBindings>
                        <DataGrid.RowDetailsTemplate>
                            <DataTemplate>
                                <TextBlock><Hyperlink Command="ApplicationCommands.Find" CommandParameter="{Binding Path=Raw.Mid}">水果搭配</Hyperlink></TextBlock>
                            </DataTemplate>
                        </DataGrid.RowDetailsTemplate>
                        <DataGrid.ContextMenu>
                            <ContextMenu Visibility="{Binding Path=Enabled, Converter={StaticResource b2v}}">
                                <MenuItem Header="水果搭配" Command="ApplicationCommands.Find"></MenuItem>
                                <Separator />
                                <MenuItem Header="删除水果" Command="ApplicationCommands.Delete"></MenuItem>
                            </ContextMenu>
                        </DataGrid.ContextMenu>
                        <DataGrid.Columns>
                            <DataGridTextColumn Binding="{Binding Path=Name}" Header="水果主料名称" 
                                    MinWidth="100" MaxWidth="200" ToolTipService.ToolTip="2 - 10个字符"/>
                            <DataGridTextColumn Binding="{Binding Path=Notes}" Header="水果主料说明" 
                                    MinWidth="200" MaxWidth="500" ToolTipService.ToolTip="0 - 50个字符"/>
                        </DataGrid.Columns>
                    </DataGrid>
                </Expander>
                <Expander x:Name="era" Header="奶制品（牛奶、酸奶、奶油等）" IsExpanded="False">
                    <DataGrid x:Name="dgmilk" ItemsSource="{Binding Path=P_milk}" IsReadOnly="{Binding Readonly}">
                        <DataGrid.CommandBindings>
                            <CommandBinding Command="ApplicationCommands.Delete" CanExecute="Majoraw_CanExecute" Executed="Delete_Executed" />
                            <CommandBinding Command="ApplicationCommands.Find" CanExecute="Find_CanExecuted" Executed="Find_Executed" />
                        </DataGrid.CommandBindings>
                        <DataGrid.RowDetailsTemplate>
                            <DataTemplate>
                                <TextBlock><Hyperlink Command="ApplicationCommands.Find" CommandParameter="{Binding Path=Raw.Mid}">奶制品搭配</Hyperlink></TextBlock>
                            </DataTemplate>
                        </DataGrid.RowDetailsTemplate>
                        <DataGrid.ContextMenu>
                            <ContextMenu Visibility="{Binding Path=Enabled, Converter={StaticResource b2v}}">
                                <MenuItem Header="奶制品搭配" Command="ApplicationCommands.Find"></MenuItem>
                                <Separator />
                                <MenuItem Header="删除奶制品" Command="ApplicationCommands.Delete"></MenuItem>
                            </ContextMenu>
                        </DataGrid.ContextMenu>
                        <DataGrid.Columns>
                            <DataGridTextColumn Binding="{Binding Path=Name}" Header="奶制品名称" 
                                    MinWidth="100" MaxWidth="200" ToolTipService.ToolTip="2 - 10个字符"/>
                            <DataGridTextColumn Binding="{Binding Path=Notes}" Header="奶制品说明" 
                                    MinWidth="200" MaxWidth="500" ToolTipService.ToolTip="0 - 50个字符"/>
                        </DataGrid.Columns>
                    </DataGrid>
                </Expander>
                <Expander x:Name="eroom" Header="菌菇类（香菇、鸡腿菇、金针菇等）" IsExpanded="False">
                    <DataGrid x:Name="dgmushroom" ItemsSource="{Binding Path=P_mushroom}" IsReadOnly="{Binding Readonly}">
                        <DataGrid.CommandBindings>
                            <CommandBinding Command="ApplicationCommands.Delete" CanExecute="Majoraw_CanExecute" Executed="Delete_Executed" />
                            <CommandBinding Command="ApplicationCommands.Find" CanExecute="Find_CanExecuted" Executed="Find_Executed" />
                        </DataGrid.CommandBindings>
                        <DataGrid.RowDetailsTemplate>
                            <DataTemplate>
                                <TextBlock><Hyperlink Command="ApplicationCommands.Find" CommandParameter="{Binding Path=Raw.Mid}">菇类搭配</Hyperlink></TextBlock>
                            </DataTemplate>
                        </DataGrid.RowDetailsTemplate>
                        <DataGrid.ContextMenu>
                            <ContextMenu Visibility="{Binding Path=Enabled, Converter={StaticResource b2v}}">
                                <MenuItem Header="菌菇类搭配" Command="ApplicationCommands.Find"></MenuItem>
                                <Separator />
                                <MenuItem Header="删除菌菇类" Command="ApplicationCommands.Delete"></MenuItem>
                            </ContextMenu>
                        </DataGrid.ContextMenu>
                        <DataGrid.Columns>
                            <DataGridTextColumn Binding="{Binding Path=Name}" Header="菌菇名称" 
                                    MinWidth="100" MaxWidth="200" ToolTipService.ToolTip="2 - 10个字符"/>
                            <DataGridTextColumn Binding="{Binding Path=Notes}" Header="菌菇说明" 
                                    MinWidth="200" MaxWidth="500" ToolTipService.ToolTip="0 - 50个字符"/>
                        </DataGrid.Columns>
                    </DataGrid>
                </Expander>
            </StackPanel>
        </ScrollViewer>
        <Button Grid.Row="1" Grid.Column="2" Visibility="{Binding Path=Enabled, Converter={StaticResource b2v}}"
                Command="{Binding Path=Save}" Content="{Binding Path=Save.Name}" HorizontalAlignment="Right"></Button>
    </Grid>
</UserControl>
